package Day11;

public class Text2 {
    public static void main(String[] args) {
        String s = new String("哈哈哈哈");
        System.out.println(s);

        char[] values = {'a','b','c','d'};
        String s2 = new String(values);
        System.out.println(s2);
        String s3 = new String(values,1,3);
        System.out.println(s3);
        byte[] bytes = {97,98,99,100,101,102};
        String s4 = new String(bytes,2,3);
        System.out.println(s4);


        //返回字符的下标的方法
        String s7 = "abcd@fs@";
        int index1 = s7.indexOf('@');
        System.out.println(index1);
        int index2 = s7.lastIndexOf('@');
        System.out.println(index2);
        //切割字符串内容的方法[0,4)
        String sub1 = s7.substring(0,4);
        System.out.println(sub1);

        //替换字符串中的特定字符的方法
        String sub2 = s7.replace('@','t');
        System.out.println(sub2);


    }
}
